#include <QTableView>

#include "mainwindow.h"
#include "qtsendsignal.h"
#include "ui_mainwindow.h"
struct MainWindowPrivate
{
    MainWindowPrivate():
        _sender(new QTSendSignal)
    {}
    QTSendSignal* _sender;
};

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    _p(new MainWindowPrivate()),
    ui(new Ui::MainWindow)

{
    ui->setupUi(this);

    ui->splitter->setStretchFactor(0,10);
    ui->splitter->setStretchFactor(1,23);

    connect(ui->pushButton_3,SIGNAL(clicked()),this, SLOT(PushTest()));
    connect(ui->pushButton_2,SIGNAL(clicked()),this, SLOT(close()));
    //connect(_p->_sender, SIGNAL(QTSendSignal::SendSingal(QString sendName)), this, SLOT(DisplayDebugMessage(QString name)));
    connect(_p->_sender, &QTSendSignal::SendSingal, this, &MainWindow::DisplayDebugMessage);
    //传入函数指针的没有问题
}

MainWindow::~MainWindow()
{
    delete ui;
    delete _p;
}

void MainWindow::PushTest()
{
    _p->_sender->Send("xiaoHua");
}
void MainWindow::DisplayDebugMessage(QString name)
{
    qDebug() << "display<-" << name;
}
